home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 24
/
Commodore_Free_Issue_24_2008_Commodore_Computer_Club.d64
/
t.b guide 9.1
< prev
next >
Wrap
Text File
|
2023-02-26
|
12KB
|
384 lines
u
In the Beginning Chaper 9, Section 1
Lord Ronin from Q-Link
Back again and into those pesky pokes
and peeks. We did do some of that
already, when we typed poke53280,x
where x is a number between 0-15, this
command Changed the colour of the
screen border. That is a poke, and one
of the first ones you learn. Now I
know that it looks like there are at
the least 53,280 poke places when you
look at the number. Besides what does
each one of them do exactly? Well
those are two questions that I as a
beginner have asked, and not yet found
the book(s) to answer them.
Keeping that in mind, lets not let
the lack of information dampen our
spirits. Take it as there is a lot one
can learn about the C=. Our next
programme may bum you out when you run
it, I know it did that to me the first
few times I entered it. I will explain
the what and why afterwards just type
in this program as shown.
new
10 forba=0to15
20 forbo=0to15
30 poke53280,ba
40 poke53281,bo
50 forx=1to2000:nextx
60 nextbo:nextba
Run this and you will have the screen
and border change colour, you may
think you entered the programme
listing incorrectly, the screen
changes colour. But what about the
border colour as it Seems to stay the
same. That is what many of the members
of the user group thought over the
years. To tell the truth so did I for
a time, that is until I tried to tear
apart the programme and find out what
was happening. To save you the
frustration it is in line 60, you need
to read that line a few times
remembering how the next command works
in a for next loop. Have you seen it
yet?
Well I didn't for a time. What happens
here is that the for that comes first
that is the one for the BA variable,
will do its thing starting at line 10.
OK got that part. Now see line 60 here
BA is going to do its thing until the
set amount, then go back in 10 with
the 0 to15 part. Right the screen
changes 16 times before the border
will change or the other way round,
depending what you put in first. I did
it both ways. In line 10 and in line
60. Mess with the placement of the BA
& BO variable and you will see what I
mean.
I think We have played enough with the
FOR NEXT loop to catch most of the
lines in some form. Line 50 is the
delay. Right I know your question now.
"2000 what?" for the delay. Can't tell
you for rock certain, but I have been
told by most people that it is a
"jiffy"; No that isn't a silly term.
Actually it is a unit of measurement
for time, here a jiffy is 1/60th of a
second. PAL users have a different one
or so I have been told. Simple
electronics here. Current/Voltage what
ever term works best for you. Changes
from a + to a - <seen on an
oscciloscope> 60 times a second. This
is called the line frequency and is
used a lot in crystals in circuits,
for timing and other things I have
long forgotten. OK that is more than
enough on that part. Just want you to
see the relationship there with the
jiffy being 1/60th of a second. Unless
what I was told was wrong.
With a little experimenting you can
shorten those lines down and make the
programme run faster. You can also fix
it to have the border and the screen
flash at about the same time. Probably
you can guess that to make it run
faster, all you need to do is change
that delay in line 50. Now how to make
both border and screen flash at the
same time? Not gonna tell ya <EG> But
I'll give you some hints. Make just
one FOR variable for the value 0 to
15. Put the two poke codes on the same
line with the : symbol between them
and use the same variable. I'll let
you play around with this and see what
you can make.
All Right! Been bugged enough to drop
back a session and tell you how to
find those 8 other colours for that
colour bar. Simply use the command
PRINTASC("X"). X here will be you
typing in the C= key and one of the
number keys. Press return and it will
tell you the code number. That is what
you use for the rest of the lines in
that colour bar programme. User Group
members and Girl Friends can be such a
pain in the Tucus. <G>
Back to that programme. Add the
following line.
25 ?chr$(147);"border
=";peek(53280)and15, "background =
";peek(53281)and15
Fits on about 1.8 lines of your
screen, shorter if you use more
shortcut codes. What happens here is
the screen clears and at the top will
be the words "border and background".
Then after the = symbol, you will see
the colour number from 0 to 15 for
each one (border or screen). Tip, if
you play with this programme and have
short end it up a bit. Make certain to
have this programme line happen after
the poke codes. If not you stand a
chance of being one number off, this
happened to the students and to me in
the process of our learning.
Now we enter a new bit and this one
is more complicated. Personally I
think its made to have you ask more
questions than it gives, while trying
to make you more interested in
programming. This trick may have
worked in the 80s. These days, the
lack of in depth information, has
turned some people off. Being
frustrated with no more information.
You may see what I mean at this point.
Screen Graphics, doesn't mean what you
may expect it to mean, at least at
this level. Remember this is from the
users book that came with the C=64,
short and allegedly simple, only three
short paragraphs. The book talks about
how we have placed characters on the
screen using the PRINT command, all
printing has been sequential. The book
speaks about moving to a specific spot
on the screen using print and cursor
commands. We haven't done that much.
Oh we did do that one to make the
bouncing ball go down a certain number
of lines. Most people at the beginning
level of programming, like me, use
cursor commands to move to a specific
point on the screen. I have copied
type in books that do the same thing.
What that would look like in a type
in book would be something on the
lines of PRINT"(cursor down 10)";
"(cursor right 5)". Taking the
starting point of what you are doing
down 10 rows and over 5 columns. What
you type in the computer would be 10
times pressing the cursor down key.
Getting the symbol on the screen each
time. Then 5 presses of the right
cursor key, also getting the right
symbol on screen. Right there we have
15 key strokes on a programming line.
There has got to be a better way? I
mean this is long and takes up
programming space. The book says just
about the same thing.
All is not lost; there are locations
in the computer memory to control
locations where to place text on
screen. Just as there is for colour
work.
There are 1000 areas on the screen, A
screen is 40 columns across by 25 rows
down. I can't make the little grid map
here for you in text but suffice to
say that it is 40 wide and 25 tall;
making 1000 squares in total on the
grid. Graph paper and lining this out
may be of a help to you as a visual
aid. OK here is something that you may
be shocked about. Each one of these
1000 locations can hold a number, a
number between the value of 0 and 255.
Yeah that means you have a choice of
256 numbers for each of the 1000 grid
areas on the screen, it all becomes a
bit mind boggling at this point. <G>
The way to place things on screen at
this at this stage is with the good
old POKE command. Putting the number
for what ever you decided upon, onto a
specific area of the screen.
However we have to now deal with some
new numbers. These numbers are the
Screen Memory Map. Being the locations
on the screen to poke things into and
therefore onto the screen. Top left
corner. Being row 0 and column 0 is
location 1024, the bottom row last
column, Or the bottom right end of the
screen is location 2023. Now you can
use the grid map and mark out the
rows. Ah row 0 is 1024 row 24 <the
last row, or 25 if you counted
starting with 1 instead of 0> Starts
out at 1984. Column 0 is the top left.
Top right is column 39. For those that
want to make their own grid chart. I
did this because the one in the book
is too small for my ancient eyes. <G>
Well of course you can count the grid
squares and find the right screen
memory location, or you could be lazy
and use a simple formula. I'm lazy
these days.
POINT =1024 + X + 40*Y
Freaky right? OK it was for me the
first several times that I went
through this part of the book. Didn't
have anyone to talk me through the
entire book.
Tearing this apart from the beginning.
POINT simply means the location on the
screen for what you are putting there,
<gotta work on the grammar>. End
result is going to be a number between
the 1024 start and the 2023 end, block
of numbers. Being the place to insert,
what ever it is you are inserting.
Yeah that was worded better. <G>
1024 is the start number, being the
one that is at the top left of the
grid. Makes that the base number to
add the rest of the stuff to for the
location.
X is the column, lets use the one
from the book, they give 20 for the
column.
Y is the row, and from the book that
is 12.
Formula would then read...
POINT = 1024 + 20 + 40*12
OK the book doesn't do that stage and
that did throw off several of my
members over the years. Putting it in
here to keep things linear. This would
then read...
POINT = 1024 +20 + 480
Finally POINT = 1524, that is the
point on the screen at the junction of
column 20 and row 12. As listed for
the Screen Memory Map.
Catch your breath after that bit, we
have some more to do, and it isn't in
my opinion giving enough time to go
trough the above.
Next thing the book wants you to do
is type in ...
poke 1524,81
poke 55796,1
Got the idea that poke is putting
something into the computer memory
location. From that previous formula
You can see that the 1524 is the
answer to that formula above with the
column of 20 and the row of 12. Guess
you have seen enough of the previous
sections to see that the 81 thing is
what is going into that 1524 area.
55796 is a new thing that is sprung on
you. Sure you know that the 1 thing is
what is going in that area. What is
55796? Out of the range of the Screen
Memory Map so can't be a location, in
that range.
Saying that you haven't typed that
stuff in as of yet. So you aren't
aware of what the screen does, when
this is completed. I want to point out
that from the colour work we have done
for the screen and the background poke
codes. That you might see the number
above as being close to the poke codes
for the colour location of the border
and screen.
That isn't correct, but it is close.
The next section of the book is on the
COLOUR MEMORY MAP. They just have you
type the above in to place a ball.
Which is the 81 code and is also the
shifted Q. Why they have you type the
stuff in, will have the ball show up
in close to the centre of the screen.
The next poke will turn that to a
white ball. If that didn't happen
check your type work, see if you are
in the upper case, if the symbol isn't
right. If the colour didn't change,
first thing is to check is if you
typed everything right. Yeah I say
that a lot and am guilty of that in my
typing in of programmes, and more
times than I want to admit. But if it
is correct and the ball didn't change
to white, don't fret, where you in
white text colour in the first place?
I mean was that the last colour that
you were using on the screen? Sounds
silly, but it has happened in the
group.
Change that 1 to a 2 in the poke that
did the colour. Right the 55796,1
becomes a 55796,2. now the ball
changes to red. Play around a bit with
the colours and with the symbols. Try
different numbers. Changing that ,81
to what ever you like from 0-255. Some
will work as one of the symbols. 32
and 96 are the space command. Right
the one for the spacebar. Oh yeah feel
free, all you space fans to make jokes
about the space BAR. [VBG]
CONTINUED IN SECTION 2